package com.tuanzi.loan.business.analyzer;

import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;

import org.springframework.stereotype.Component;

import com.google.common.collect.Sets;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Ray 2017/11/01
 */
@Slf4j
@Component
public class InstallAppAnalyzer {

	public Integer countLoanAppIntersection(Set<String> packageNames) {
		return packageNames.parallelStream().filter(x -> LOAN_APP_PACKAGE_NAMES.contains(x)).collect(Collectors.counting()).intValue();
	}

	public Integer countPdlAppIntersection(Set<String> packageNames) {
		return packageNames.parallelStream().filter(x -> PDL_APP_PACKAGE_NAMES.contains(x)).collect(Collectors.counting()).intValue();
	}

	private static final Set<String> LOAN_APP_PACKAGE_NAMES = Sets.newHashSet("com.lingyue.YqdAndroid", "com.cashbus.android.swhj", "com.kdlc.mcc", "com.aldb.android",
			"com.innext.xjx", "com.youtuker.xjzx", "com.xiangbudao.xjjd", "com.flash.cash", "cn.cash365.android", "com.xianjin.main", "com.qianyinjinrong.app12a",
			"com.wdzj.borrowmoney", "apps.cashboxs", "cn.cashfree.loan", "com.duorong.xianjingdai", "com.app.xianjinzhijia.main", "com.geo.cashcow", "com.zhouji.luotuo",
			"com.app.finance", "cn.mifengkong.loan", "cn.guorun.mt", "cn.mifengkong.cps", "com.Michael.xianjinka", "com.xinhe.cashloan", "com.beihui.aixinqqqq",
			"cn.mifengkong.huaxiaapp", "com.gcs.wang.loan", "com.innext.ztc", "com.ty.firstlywallet", "com.ahxbapp.xjxx", "com.fengniao.action", "com.rongba.xianjindaikuan",
			"com.duorong.xianjingdai", "com.loan.petty.pettyloan", "com.xjqb", "com.chutong.casheasy.app", "com.wildcode.cashtaxi", "cn.shishidai.H5D5071E4",
			"com.chenggutek.cashpocket", "com.jiafenqi.loanmanager.sjjk", "com.bangnidai.app", "com.htouhui.pdl.xianjingou", "com.v358093267.qgm", "com.youtuker.zdb",
			"com.xianjinxia", "com.niuwa.niubei.android", "com.kdlc.mj2", "com.wildcode.kuaika", "com.t358093267.kry", "com.xinhe.cashloan", "com.cn.moonlightbluecard",
			"com.junzhuo.xianjinbang", "com.yongqianbei.loan", "com.huocheche", "com.shuqu.microcredit", "com.mjoys.finaceapp", "com.yongqianbao.borrowmoney", "com.ahxbapp.xjsd",
			"com.qhhy.xjjq", "com.treefinance.supermarket", "com.kuxuan.money", "com.mjb.moneymanager.jkb", "com.a358093267.vvo", "com.xinhe.cashloan", "com.xinyongfei.xyf",
			"com.qsq.loankaka", "com.jiafenqi.loanmanager.xjdkjq", "com.ahxbapp.xjyijie", "com.huaxin.jieqianhua339", "jinfujt.com.xjmm", "com.example.administrator.immediatecash",
			"com.example.pro_phonexjdk", "com.aloestec.cash.xigua", "com.innext.cash", "com.app.feisuda", "com.alfl.www", "com.treefinance.supermarket", "com.sogou.androidtool",
			"com.mjb.moneymanager.likefq", "com.liquan.xjxjq", "com.canfu.kdgeb", "com.xybt.xjbkfuli", "com.kdlc.mj2", "com.zlkj.xianjinzaixiandk",
			"com.mai400.android.xianjinsujie", "com.app.xianjincf", "com.martian.alihb", "cn.jiujiudai.wubadaikuan", "com.zhangzhong.loan.xjdai", "com.xncredit.pad",
			"com.qiantong.daikuan", "com.rst.cashloan", "com.woyaoxianjin", "cn.daoan.xianjinloan", "com.rongba.xianjin", "com.yiqiwork.xidai", "com.rzj.jsjk",
			"com.guwen.app.xjxd", "com.htffund.mobile.ec.ui", "com.ahxbapp.xjjsd", "com.sirbaylor.speed", "com.xjdk.credit", "com.z929178222.jsdxjd405", "com.qicash.cash74",
			"com.jq.credit", "com.ahxbapp.xjqiandai", "com.dk.xjjd", "com.yuntu.jkzjzyb", "com.qiantu.sdzx", "cn.paidan.jiebei", "www.odin.com.xjfxd", "com.qijiukeji.xjkd",
			"com.app.xianjinjisuda", "com.r358093267.emh", "com.xdq.quickloan", "com.jiafenqi.loanmanager.xykjq", "com.ppdai.loan.buy", "com.daixiaoqian", "com.qhhy.xjjq",
			"com.huaxin.jieqianhua82", "com.qijiukeji.xjkd", "com.ahxbapp.xjshidai", "com.c358093267.euy", "com.zhangzhong.borrow.xjjq", "com.loancommon", "com.ahxbapp.xjkd",
			"com.huaxin.jieqianhua70", "com.cbb19900208.wbp", "com.huaxin.jieqianhua228", "com.a358093267.vvo", "com.dai58.miaojiexianjin", "com.modai.xianjinmoka", "com.xfqz.xjd",
			"com.wta.NewCloudApp.jiuwei80432e", "com.xianjinxiaoge.main", "cn.jiujiudai.tiantianjiekuan", "com.caimao.cashloan.xjjk", "app.xuezhongdai.com.xzjrapp",
			"com.example.moneystagesyingyongbao", "cn.cashfree.xianjindai", "com.baas.tbk676", "com.dkw.credit", "com.yuyong.jiekuanbao", "com.Michael.xianjinka",
			"com.quickCashLoan", "com.qijiukeji.xjkd", "com.suishixianjin.company", "com.thans.xianjinyidai", "cn.jiujiudai.jiedaiba", "com.yuntu.jkzjflb", "com.baidu.appsearch",
			"com.example.pro_phones_jtb", "com.sogou.androidtool", "com.zlkj.xianjinbaikaw", "com.ahxbapp.loan", "com.huaxin.jieqianhua225", "com.xncredit.loan",
			"com.mjoys.finacestore", "com.yunshuo.kdxj", "com.sirbaylor.shandian", "com.www.cn.shoujixianjindai", "com.qhhy.xjjq", "com.innext.xjx", "net.zombie_sama.xianjinbashi",
			"com.mjb.moneymanager.creditdk", "com.sogou.androidtool", "com.baidu.appsearch", "bill.zts.com.mofaxianjin", "com.sogou.androidtool", "com.caimao.cashloan.jkkz",
			"com.huanyue.qingsonglend.welfare", "com.yongqianbao.borrowmoney", "com.z929178222.xjdkxm202", "com.treasureapp.xianjinbaikadai", "com.gree.xianjzxd",
			"com.baidu.appsearch", "com.jinqianbao.xjbk", "com.baidu.appsearch", "com.liquan.xjxlxb", "com.feilai.shan", "cn.mifengkong.huaxiaapp", "com.xjjk.credit",
			"com.xjdx.xianjindaxia50228", "cn.mirong.loan1", "com.xiaoiyunque.xiaoyunque", "com.cashapp.xjjb", "com.xiangjinjiayouzhan.main", "com.zjjyy.wang.loan",
			"com.xjhuahua.loan", "com.example.apple.xianjinxia", "com.weirong.wrjkfb", "com.xiyoukeji.xinhuahua", "com.wczr.speedloan", "com.z929178222.msd421",
			"mobi.woyaocashloan", "com.liquan.xjxyq", "com.zhangzhong.loan.xjdai", "com.qianwanwan.jinjiebao", "com.mjb.moneymanager.jsdk", "com.zlkj.xianjinkuaidaijkb",
			"com.jisujiedaihaojieqianzhushou.money", "com.soodai.LGS", "com.mjb.moneymanager.jsdk", "cn.daoan.qianbao", "com.www.cn.xianjinwanka", "com.dk.xjjkk",
			"com.zlkj.xianjinxia", "com.jiafenqi.loanmanager.xjqb", "com.nfsq.xianjzxqb", "com.qmdk.xjdkjd", "com.sunmeng.daxiangxinyongandroid", "com.feilu.flashloan",
			"com.zhijie.jisuloan", "com.hzzc.investor", "cn.creditcrest.toloan", "com.z929178222.xjw", "com.jd360.xjm", "com.gongyinruixin", "com.caimao.cashloan.dkx",
			"com.baidu.appsearch", "io.dcloud.H5E886092", "com.sogou.androidtool", "com.baidu.appsearch", "com.yingjidai", "com.yame.caidai22", "www.odin.com.xjbkb",
			"com.baidu.appsearch", "com.mjb.moneymanager.xjqb", "com.alfl.www.borrowSuperman", "com.home5566.cash", "com.baidu.appsearch", "com.example.xianjinjinkayinyongbao",
			"com.weirong.wrdkfb", "com.xianjinchaoren", "com.ionicframework.zwxjmf813242", "com.zzcm.fastborrow", "com.wzy.xiaoshimindaikuanzhushou", "com.rzj.dkds",
			"com.cn.moonlightbluecard", "com.qhhy.xjjq", "com.baidu.appsearch", "com.yuntu.daikuanbei", "com.sogou.androidtool", "com.mjb.moneymanager.xjdkjq", "com.dkhelpercre",
			"com.isq.loan_market.loan_market", "com.sogou.androidtool", "bill.zts.com.mofaxianjin", "com.gree.chaorxjd", "com.jq.sjxj", "com.mjb.moneymanager.xjsdjk",
			"com.treasureapp.geinihuaxianjinjiekuan", "com.huaxin.jieqianhua167", "com.juhe.cash", "com.haodai.loanpro", "com.sogou.androidtool", "com.rong3600.xianjindai",
			"com.zlkj.jinqiannainiu", "com.mjb.moneymanager.kqdk", "com.loancommon", "com.home5566.cash", "com.huaxin.jieqianhua230", "com.yaqi.mj.xianjin",
			"com.huanyue.qingsonglend.official", "com.xiangjinjiayouzhan.main", "com.mjb.moneymanager.xjqbsdjk", "com.huaxin.jieqianhua100", "com.xncredit.loan",
			"com.baidu.appsearch", "com.example.xjnn52", "com.sunmeng.xianjinzhouzhuan", "com.example.xianjinxiajisubanyingyongbao", "com.apple.xianjinniu",
			"com.yuanao.xjdfqjkX23", "com.x50794jjk.xianjinjiekuan", "com.loan.xiaomayixianjindai", "com.xjqb", "com.shhxzq.xjb", "com.huanyue.freelend.lendlend",
			"com.huarongxjb.dzh", "com.dizs.xjh", "com.x50791jqz.xianjinqianzhan", "com.huangguan.hgmoney", "com.ceylxj4", "cn.mifengkong.loan2", "com.example.xjxkz",
			"com.xiecc.xianjinshoujidai", "com.sogou.androidtool", "com.manyishuo.comjxxjqp1", "com.qhsd.xjd", "com.xft.loan", "com.xiangjinjiayouzhan.main", "com.haopeng.xianjin",
			"com.mjb.moneymanager.xjb", "com.dkqb.credit", "io.thans.xianjinyidai", "com.zhangzhong.borrow.hbdkfq", "com.xjqb", "com.wta.NewCloudApp.jiuwei156063",
			"com.sunmeng.androidmashangdai", "com.zzcm.fastborrow", "com.syj.jsxjj", "com.gjj51.housingfund.beijing", "com.isq.loan_market.loan_market", "com.yuanao.jqxjdkrjX26",
			"com.mjb.moneymanager.xjfqjq", "com.mjb.moneymanager.jqgnh", "com.loan.platform", "com.jqb.credit", "com.mjb.moneymanager.jsjq", "com.mjb.moneymanager.jkb",
			"com.a726787295.gamecash", "com.xinhe.xianjinchaoren", "io.dcloud.H50BDC243", "com.sooying.daikuanbao", "com.kuozheng.demo1", "com.example.apple.xianjinbashi",
			"com.niuwa.niubei.android", "com.choujiang500", "com.lvzuanshd", "com.yuntu.jkzjjsb", "com.baidu.appsearch", "c.b.h", "com.home5566.cash",
			"com.sunmeng.shanyinxianjindaiandroid", "com.loan.wannengdai", "com.huaxin.jieqianhua95", "com.yuanao.xjjqkX16", "com.z929178222.xjdhw206", "com.bangnidai.app",
			"com.qmdk.xjdkjd", "com.apple.xianjinniu", "com.yuntu.daikuanbei", "com.weirong.wrjkfb", "com.crfchina.market", "com.jfbank.wanka", "com.yuecai.mochouhua",
			"com.lsxinyong.www", "com.sinaif.credit", "com.shudu.chaoshi", "com.jiuji51.android.microloan", "com.luke.chitupay", "com.bank9f.staging", "com.xjkc", "com.xssd.xsph",
			"com.vcredit.j1000", "com.chutong.casheasy.app", "com.heige.mxlife", "com.huaxin.jieqianhua548", "com.example.yixinyingyongbao", "com.llq.linglingqihd",
			"com.xinhe.hengchang", "com.bestpay.creditcard");

	private static final Set<String> PDL_APP_PACKAGE_NAMES = Collections.unmodifiableSet(Sets.newHashSet("com.mintq.xqd", "com.jiuji51.android.microloan", "com.example.junbangdai",
			"com.vcredit.j1000", "com.qijiukeji.jyq", "com.wlf.slx", "com.mjn.wallet", "com.geo.speed", "com.caimi.pdloan", "com.bank9f.staging", "com.xjkc", "com.xiaoV.VWallet",
			"com.wildcode.feipigdai", "com.zhaoqianhua.cash", "com.vcredit.ddflower", "cgjr.com.cgjr", "com.chinazyjr.creditloan", "com.yuezubao.jiesantian",
			"com.xiangshang360.threedollars", "com.chutong.casheasy.app", "com.xinhe.jianghu", "org.mhApp.YRDProject", "www.odin.com.odin", "com.lianchuan.kaledai",
			"com51daikuan.jiyongqian", "com.example.helpyingyongbao323", "com.example.jianghujiujihuawei", "com.fuyin.lmyq", "com.example.helpbaidu322company", "cn.hjf.xinyongka",
			"com.example.huawuyouvivo", "com.jhjj.jianghujiuji50453", "com.www.cn.naxiaqianbao", "net.zombie_sama.jiyongqian", "com.qsd.app", "com.chengkai1989.wwq",
			"com.example.riversandlakeshelpanzhipcompany", "com.huawuyou.loan", "com.www.cn.jianghujiuji", "com.yrd.yrd100", "com.tang.jianghujiuji",
			"com.example.xinyonghuayingyongbao", "com.example.huawuyoubaidu", "com.anniu.jiyongqian", "com.example.helpvivo", "com.j126897hjj.jianghujiuji",
			"com.texas.shmodel6client", "com.system.borrow48", "com.www.cn.zhubaoqianbao", "com.qsd.yuexiankeji", "com.example.helpyingyongbao321company", "com.lk.mqbsuper.pay",
			"com.abc.demo", "com.zhu.myzhu", "kaledai.maiadai.com", "com.qt.jyqq", "com.puhui.xueershi.xiangqiandai", "com.hfsj.duoduofu", "com.example.huawuyouanzhi",
			"com.example.sanwenqianvivo", "com.manding.yrd", "com.yinker.VWallet", "com.example.wubanqianbao", "com.whb.paypos", "com.mjn.wallet_lite",
			"com.example.huawuyouhuawei", "com.example.qnjk41", "com.www.cn.jiejitiantwo", "com.caihongqb.app", "com.hdsy.hongdapay.ddpay", "com.dufu.www.wubqb",
			"com.mfxyqb.borrowmoney", "com.example.huawuyouoppo", "com.wallet.board.fiveboard", "com.example.jjt53", "com.www.cn.jiejitian", "com.j130135yq.jiyongqian",
			"com.example.swqyb", "com.jishiyu.tree", "com.example.chqb", "com.j130140yq.jiyongqian", "com.treasureapp.jiyongqian", "com.enniu.xiaowuqianbao", "com.jinan.kaledai",
			"com.housingfund.babaqianbao", "com.lsxinyong.www", "com.il360.hangyingdai", "com.huaxin.jieqianhua506", "com.haikou.nuanxindaiyyb", "com.wuhan.wubanbaidu",
			"com.il360.xiaobeidai", "com.akmob.yirongdai", "com.taojiang.kaledaivivo", "com.letianpai.jiyongqian", "com.wta.NewCloudApp.jiuwei80432g", "com.glkj.airlinepurse",
			"com.xiaolian.loan", "com.ymnet.wubqb", "com.zhuzhou.fenxinxyhw", "com.www.cn.kaledai", "com.glkj.spendmonth", "com.example.jqmyb", "com.ppmoney.sjbc",
			"com.ymnet.doudh", "cgjr.com.kvcgjr", "com.example.kaledai", "org.xqj.naxiaqianbao", "com.lk.ddfsuper.pay", "com.glkj.voyagepurse", "com.example.xyhyb",
			"com.example.changhuahua", "com.personal.song.songjiang", "com.mofang.mfqb", "com.doudou.ddh", "com.example.kldapp", "com.weizhong.jiyongqian"));
}
